package com.ssm.subject.infra.basic.service.impl;

import com.alibaba.fastjson.JSON;
import com.ssm.subject.infra.basic.entity.SubjectRadio;
import com.ssm.subject.infra.basic.mapper.SubjectRadioDao;
import com.ssm.subject.infra.basic.service.SubjectRadioService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 单选题信息表(SubjectRadio)表服务实现类
 *
 * @author makejava
 * @since 2024-11-29 10:24:45
 */
@Service("subjectRadioService")
@Log4j2
public class SubjectRadioServiceImpl implements SubjectRadioService {
    @Resource
    private SubjectRadioDao subjectRadioDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public SubjectRadio queryById(Long id) {
        return this.subjectRadioDao.queryById(id);
    }

    /**
     * 修改数据
     *
     * @param subjectRadio 实例对象
     * @return 实例对象
     */
    @Override
    public int update(SubjectRadio subjectRadio) {
        return this.subjectRadioDao.update(subjectRadio);
    }

    /**
     * 批量插入
     * @param subjectRadioList
     */
    @Override
    public void batchInsert(List<SubjectRadio> subjectRadioList) {
        if(log.isInfoEnabled()) {
            log.info("SubjectRadioService.add.subjectRadioList:{}", JSON.toJSONString(subjectRadioList));
        }
        this.subjectRadioDao.batchInsert(subjectRadioList);
    }

    /**
     * 查询
     * @param subjectRadio
     * @return
     */
    @Override
    public List<SubjectRadio> query(SubjectRadio subjectRadio) {
        return this.subjectRadioDao.query(subjectRadio);
    }

}
